package com.iot.common.core.util;

import javax.servlet.http.HttpServletRequest;

public class RequestUtil {
	public static boolean isAjaxRequest(HttpServletRequest request) {
		String requestedWith = request.getHeader("x-requested-with");
		if (requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest")) {
			return true;
		} else {
			String accept = request.getHeader("accept");
			if (accept == null || accept.contains("application/json")) {
				return true;
			}else{
				return false;
			}
		}
	}
}
